package com.xcity.game.battle.pve.employee;

import org.slf4j.Logger;

import com.xcity.game.battle.pve.PlayerBattler;
import com.xcity.game.employee.EmployeeService;
import com.xcity.game.employee.skill.EmployeeSkill;
import com.xcity.game.employee.skill.SkillGroups2;

public class EmployeeSkillBattleContextFactory {

	protected static final Logger LOG = EmployeeService.LOG;
	
	public static EmployeeSkillBattleContext create(PlayerBattler player, EmployeeSkill skill) {
		SkillGroups2 group = SkillGroups2.of(skill.getTemplate().getGroup());
		Class<? extends EmployeeSkillBattleContext> clazz = group.contextClass;
		try {
			return clazz != null ? clazz.getConstructor(PlayerBattler.class, EmployeeSkill.class).newInstance(player, skill) : null;
		} catch (Exception e) {
			LOG.error(e.getMessage(), e);
		}
		return null;
	}
	
}
